<template>
	<view class="page">
		<view class="pages">
			<view class="herder">
				基本信息
			</view>
			<view class="item flex align-items ">
				<view class="item_left">操作任务</view>
				<view class="item_right">
					<u-input placeholder="请输入" v-model="form.taskName" :readonly="true" :fontSize="16"
						placeholderClass="placeholderClass"></u-input>
				</view>
			</view>
			<!-- <view class="item flex align-items ">
				<view class="item_fu">操作设备</view>
				<view class="item_right  flex align-items">
					<u-input placeholder="暂未选择" :fontSize="16" :readonly="true" placeholderClass="placeholderClass"
						style="pointer-events:none" v-model="form.deviceName"></u-input>
				</view>
			</view> -->
			<view class="item flex align-items ">
				<view class="item_left">操作票专业</view>
				<view class="item_right  flex align-items">
					<u-input v-model="form.category" placeholder="请选择" :fontSize="16" :readonly="true"
						placeholderClass="placeholderClass" style="pointer-events:none"></u-input>
				</view>
			</view>
			<view class="item flex align-items ">
				<view class="item_left">期</view>
				<view class="item_right">
					<u-input v-model="form.edition" :readonly="true" placeholder="请输入" :fontSize="16"
						placeholderClass="placeholderClass" ></u-input>
				</view>
			</view>
		<!-- 	<view class="item flex align-items ">
				<view class="item_left">页数</view>
				<view class="item_right">
					<u-input v-model="form.numberPages" placeholder="请输入" :fontSize="16"
						placeholderClass="placeholderClass" type="number" :readonly="true"></u-input>
				</view>
			</view> -->
			<view class="item flex align-items ">
				<view class="item_left">操作部门</view>
				<view class="item_right  flex align-items">
					<u-input placeholder="请选择" :fontSize="16" :readonly="true" placeholderClass="placeholderClass"
						v-model="form.depatName" style="pointer-events:none"></u-input>
				</view>
			</view>
			<view class="item flex align-items ">
				<view class="item_left">操作人</view>
				<view class="item_right  flex align-items">
					<u-input placeholder="请选择" :fontSize="16" :readonly="true" placeholderClass="placeholderClass"
						v-model="form.operateUserName" style="pointer-events:none"></u-input>
				</view>
			</view>
			<view class="item flex align-items ">
				<view class="item_left">监护人</view>
				<view class="item_right  flex align-items">
					<u-input v-model="form.guardianUserName" placeholder="请选择" :fontSize="16" :readonly="true"
						placeholderClass="placeholderClass" style="pointer-events:none"></u-input>
					<!-- <u-icon name="arrow-right" color="#CCCCCC" :size="16"></u-icon> -->
				</view>
			</view>
			<view class="item flex align-items ">
				<view class="item_left">一级审批 </view>
				<view class="item_right  flex align-items">
					<u-input placeholder="请选择" :fontSize="16" :readonly="true" placeholderClass="placeholderClass"
						v-model="form.monitorUserName" style="pointer-events:none"></u-input>
					<!-- <u-icon name="arrow-right" color="#CCCCCC" :size="16"></u-icon> -->
				</view>
			</view>
			<view class="item flex align-items ">
				<view class="item_left">二级审批</view>
				<view class="item_right  flex align-items">
					<u-input placeholder="请选择" :fontSize="16" :readonly="true" placeholderClass="placeholderClass"
						v-model="form.shiftSupervisorName" style="pointer-events:none"></u-input>
					<!-- <u-icon name="arrow-right" color="#CCCCCC" :size="16"></u-icon> -->
				</view>
			</view>
		
			<!-- <view class="item flex align-items ">
				<view class="item_left">作业前准备</view>
			</view>
			<view class=" margin-top10">
				<u-textarea v-model="form.preparationContent" placeholder="请输入" :disabled="true" :fontSize="16"
					placeholderClass="placeholderClass" style="font-size: 16px;"></u-textarea>
			</view> -->
		</view>
		<!-- <view style="background-color: #F6F6F6;height: 15rpx;"></view>
		<view class="pages">
			<view class="item   flex align-items ">
				<view class="item_left" style="width: 240rpx;">员工授权停工</view>
			</view>
			<view class="margin-top10 ">
				<u-textarea v-model="form.shutdownContent" height="220" placeholder="请输入" :disabled="true"
					:fontSize="16" placeholderClass="placeholderClass" style="font-size: 16px;"></u-textarea>
			</view>
		</view> -->
		<view style="background-color: #F6F6F6;height: 10rpx;"></view>
		<!-- 		<view class="pages">
			<view class="item flex align-items " style="border: none;" @click="jumpTo('/pages/newRisks/newRisks')">
				<view class="item_left" style="width: 240rpx;">风险控制措施</view>
				<view class="item_right  flex align-items">
					<u-input placeholder="请选择 " v-model="form.listRisk.length" :fontSize="16" :readonly="true"
						placeholderClass="placeholderClass" color="#267DFF" inputAlign="right"
						style="pointer-events:none"></u-input>
					<u-icon name="arrow-right" color="#CCCCCC" :size="16"></u-icon>
				</view>
			</view>
		</view> -->
		<!-- 	<view style="background-color: #F6F6F6;height: 10rpx;"></view>
		<view class="pages">
			<view class="item flex align-items " style="border: none;"
				@click="jumpTo('/pages/newOperation/newOperation')">
				<view class="item_left">操作项目</view>
				<view class="item_right  flex align-items">
					<u-input placeholder="请选择 " v-model="form.listProcess.length" :fontSize="16" :readonly="true"
						placeholderClass="placeholderClass" color="#267DFF" inputAlign="right"
						style="pointer-events:none"></u-input>
					<u-icon name="arrow-right" color="#CCCCCC" :size="16"></u-icon>
				</view>
			</view>
		</view> -->
		<view class="pages">
			<view class="item flex align-items " style="border: none;">
				<view class="item_fu a">操作</view>
				<view class="item_right  flex align-items">
					<div class="mshh">
						<image src="/static/img/index/yixuanzhong.png" mode="" v-if="form.operateType !=1"></image>
						<image src="/static/img/index/xuanzhong.png" mode="" v-if="form.operateType ==1"></image>
						<div>监护操作</div>
					</div>
					<div class="mshh">
						<image src="/static/img/index/yixuanzhong.png" mode="" v-if="form.operateType !=2"></image>
						<image src="/static/img/index/xuanzhong.png" mode="" v-if="form.operateType ==2"></image>
						<div>单人操作</div>
					</div>
				</view>
			</view>
		</view>
		<view style="background-color: #F6F6F6;height: 10rpx;"></view>
		<view class="pages">
			<view class="item flex align-items " style="border: none;">
				<view class="item_fu a" style="flex:   0 0 auto;">关联票</view>
				<view class="item_right    flex align-items" style="font-size: 26rpx;word-break: break-all;width: 600rpx; ">
			<!-- 		<u-input placeholder="暂未选择 " v-model="form.guanlian" :fontSize="16" :readonly="true"
						placeholderClass="placeholderClass" inputAlign="right" style="pointer-events:none"></u-input> -->
						{{form.guanlian}}		
				</view>
			</view>
		</view>
		<view style="background-color: #F6F6F6;height: 10rpx;"></view>
		<view class="pages">
			<view class="items flex align-items justify-content-between " style="height: 136rpx;">
				<view class="item_fu">附件</view>
				<view class="textName" v-if="!form.annexUrl">暂无附件</view>
				<view v-if="form.annexUrl" class="textName" @click="nearby()">查看附件</view>
			</view>
		</view>
		<view style="background-color: #F6F6F6;height: 10rpx;"></view>
		<u-button class="btn" @click="comit()" :loading="loading" loadingText="提交中">下一步</u-button>
		<helangcompress ref="helangCompress"></helangcompress>
	</view>
</template>

<script>
	import {
		getDicListByCode,
		lssueAdd,
		getListDeptForZTree,
		sysUserList,
		deviceInfoList,
		getOperateUser,
		getAssociationOrderList
	} from '@/api/lssue.js'
	import urlConfig from "@/request/urlConfig.js";
	import helangcompress from '@/components/helang-compress/helang-compress.vue'
	export default {
		components: {
			helangcompress
		},
		props: {
			form: {
				type: Object,
				default: {}
			}
		},
		data() {
			return {
				baseUrl: urlConfig.baseURL,
				keyword: '',
				// form: {
				// 	fileName: '',
				// 	taskName: '', //操作票名称
				// 	device: '', //操作设备
				// 	deviceName: '',
				// 	deptId: '', //部门ID
				// 	depatName: '', //	部门名称
				// 	edition: '', //	期
				// 	numberPages: '', //	页数
				// 	category: '', //	操作票类型
				// 	operateUserId: '', //	操作人id
				// 	operateUserName: '',
				// 	guardianUserId: '', //	监护人id
				// 	guardianUserName: '',
				// 	shiftSupervisorId: '', //	值长id
				// 	shiftSupervisorName: "", //名称
				// 	monitorUserId: '', //	 值班长
				// 	monitorUserName: '', //
				// 	annexUrl: '', //附件url
				// 	listRisk: [], //操作票-风险措施表
				// 	listProcess: [], //操作票-流程模板表
				// 	parentId: '',
				// 	parentName: '',
				// 	preparationContent: `1、获取作业许可2、填写操作安全分析`,
				// 	shutdownContent: '在此本人已经授权，不惧怕任何谴责或报复，立即停止所有危害到公众、工友和本人的工作活动；对该情况的质疑、校正行为都不能认为是不遵守我们的安全和健康准则；将所有不安全情况和行为上报给监管部门，对任何涉及违反已建立的安全、健康守则的活动提出质疑。'
				// },
				value3: 10,
				options: [],
				cancelOption: [],
				categoryShow: false,
				keyName: '', //定义一个字段名称
				keyId: '', //定一个字段id
				DEPT_ID: '',
				type: '0', //0部门单选 1用户单选 2用户多选
				state: 0,
				deviceList: [],
				loading: false,
				shebeiShow: false,
				names: "",
				device: '',
				deviceName: '',
				pickerShow: false,
				columns: []
			};
		},
		onLoad(option) {},
		onShow() {
			// uni.$once('risk', e => {
			// 	console.log('risk返回值', e);
			// 	this.form.listRisk = [...e]
			// 	getApp().globalData.listRisk = [...e]
			// })
			// uni.$once("process", e => {
			// 	console.log('process返回值', e);
			// 	this.form.listProcess = [...e]
			// 	getApp().globalData.listProcess = [...e]
			// })
		},
		mounted() {
			if (this.form.correlationNumbers.length > 0) {
				this.form.guanlian = this.form.correlationNumbers.map(v => v.orderNumber).toString()
				// this.form.guanlian ='SHJ123QT240300013,SHJ123QT240300013 '
				console.log(this.form.guanlian, "guanlian");
				this.$forceUpdate()
			}
		},

		methods: {
			comit() {
				this.$emit("nuxt", 1)
			},
			nearby() {
				const extensionUrl = urlConfig.nearbyUrl + this.form.annexUrl
				const extension = extensionUrl.split('.').pop().toLowerCase();
				console.log(extensionUrl, "extensionUrl");
				if (extension == 'pdf') {
					window.android.startDoc(extensionUrl);
				} else {
					window.open(extensionUrl)
				}
			},
		},
	}
</script>

<style lang="scss" scoped>
	.page {
		background-color: #FFFFFF;
	}

	.pages {
		padding: 0 31rpx;
	}

	.herder {
		height: 90rpx;
		background: #FFFFFF;
		padding: 29rpx 0;
		font-family: PingFangSC, PingFang SC;
		font-weight: 500;
		font-size: 33rpx;
		color: #000000;
		text-align: left;
		font-style: normal;
		border-bottom: 1rpx solid #E6E6E6;
		padding-top: 0;
	}

	.item {
		min-height: 80rpx;
		border-bottom: 1rpx solid #E6E6E6;

		&_left {
			width: 196rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 400;
			font-size: 33rpx;
			line-height: 47rpx;
			text-align: left;
			font-style: normal;
			color: #666666;
		}

		&_left::before {
			content: '*';
			color: #FF0000;
		}

		&_right {
			flex: 1;

			/deep/.u-input {
				height: 65rpx;
				margin: 0 auto;
				font-size: 16rpx;
			}
		}

		&_fu {
			width: 196rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 400;
			font-size: 33rpx;
			line-height: 47rpx;
			text-align: left;
			font-style: normal;
			color: #666666;
		}

		&_upload {
			width: 307rpx;
			height: 98rpx;
			background: #267DFF;
			text-align: center;
			line-height: 98rpx;
			font-family: PingFangSC, PingFang SC;
			font-weight: 400;
			font-size: 29rpx;
			color: #FFFFFF;
		}

	}

	.btn {
		background: #267DFF;
		width: 100%;
		height: 89rpx;
		text-align: center;
		line-height: 89rpx;
		font-family: PingFangSC, PingFang SC;
		font-weight: 400;
		font-size: 29rpx;
		color: #FFFFFF;
	}

	/deep/.placeholderClass {
		font-weight: 400;
		font-size: 24upx;
		color: #CCCCCC;
	}

	/deep/.uni-textarea-textarea {
		font-size: 16px;
		background: #FFF;
	}

	.textName {
		width: 560rpx;
		word-wrap: break-word;
		white-space: pre-line;
		text-align: right;
	}

	.device {
		height: 1000rpx;
		padding: 0 30rpx;
		padding-top: 30rpx;

		&_serch {
			margin-top: 20rpx;
		}

		.devHerders {
			.devclose {
				font-size: 30rpx;
				color: rgb(144, 145, 147);
			}

			.comit {
				font-size: 30rpx;
				color: rgb(60, 156, 255);
			}

		}

		&_herder {
			margin-top: 20rpx;
			border: 1rpx solid #E6E6E6;
			border-right: none;
			height: 70rpx;

			view {
				text-align: center;
				border-right: 1rpx solid #E6E6E6;
				font-size: 28rpx;
				flex: 1;
				line-height: 70rpx;
			}

		}

		&_item {
			min-height: 80rpx;
			border-bottom: 1rpx solid #e6e6e6;
			border-left: 1rpx solid #E6E6E6;

			.itemss {
				text-align: center;
				border-right: 1rpx solid #E6E6E6;
				font-size: 28rpx;
				flex: 1;
				display: flex;
				justify-content: center;
				align-items: center;
				word-wrap: break-word;
				word-break: break-all;
			}
		}
	}

	.sordec {
		height: 790rpx;
		overflow-y: scroll;
	}

	.base {
		text-align: center;
		margin-top: 80rpx;
		font-size: 30rpx;
	}

	.yuans {
		display: flex;
		width: 40rpx;
		height: 40rpx;
		border: 1rpx solid #E6E6E6;
		border-radius: 50%;
	}

	/deep/.uni-textarea-textarea {
		font-size: 16px;
		background: #FFF !important;
	}

	/deep/.u-textarea--disabled {
		background: #FFF !important;
	}

	.mshh {
		display: flex;
		align-items: center;
		margin-right: 20rpx;
		font-size: 33rpx;

		image {
			width: 40rpx;
			height: 40rpx;
			margin-right: 10rpx;
		}
	}
	/deep/.uni-input-input{
	font-size: 24rpx;
	}
	/deep/.uni-textarea-textarea {
		font-size: 32rpx;
	}
</style>